home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
math
/
differ.zip
/
DIFFER.DOC
< prev
next >
Wrap
Text File
|
1996-04-06
|
5KB
|
112 lines
/*
DIFFER DOCUMENT EXPLAINING BASIC USAGE
This program was written to help with differentiation. It accepts
algebraic expressions with support for a number of functions and will
differentiate the expression with respect to x.
This program was written by Paul Young, using Turbo C++.
I accept no responsibility for use or misuse of this program in any way.
This program is Public Domain.
It may be copied freely provided this notice is included.
This program may be used as a base or included in other programs
however these programs must also be Public Domain and no monetary gain
should be made from these. Help support Public Domain programming.
*/
NB This program should be easily extendible using a C Compiler with the
routines already present, although it is already a fairly complete program.
Some people may feel the need to add further simplifications or functions
but generally this shouldn't be necessary.
The power of the program is its ability to handle very complicated
expressions like say sin(cos(x^tan(x)-ln(arccosh(1/x^4*sinh(x))))).
COMMANDS
--------
There are a number of commands available and these will be described
below. Where an expression is expected it is indicated as <expr>. These
and supported functions will be discussed later.
COMMAND SUMMARY
---------------
Command Action
--------------------------------------
quit Quits the program.
go <expr> This is one of the most useful
commands at first. It enters the expression,
differentiates and simplifies before
displaying the result.
again This instructs the program to continue with
the same expression. It differentiates it
again, simplifies and displays the result.
batch <expr> This is similar to 'go' but it prints out
the first expression before doing anything.
It also prints a header 'Input expression'
and a second one 'Output expression' before
the expressions. Its use is that commands
can be entered into a text file, ending with
quit. The text file can be directed as input
to the program and output directed to another
file (see go.bat). In this way the whole thing
can be automated over a list of expressions.
The remaining commands are more easily used for debugging, when making any
alterations to the program.
input <expr>
expr <expr> These do the same thing. An expression is
typed and held in memory.
print Prints the current expression to the screen.
diff Differentiates the current expression, but
note that this is not simplified (and the
result will be ugly).
simplify Simplifies the current expression.
EXPRESSIONS
-----------
Expressions are simple to enter. Here are some valid expressions :-
x^2+3*x^3-7*x^4
a*x^3+b*x^2+c*x+d
(x+2)^(x-7)
(-x)^7
sin(x)
sin(cos(x))
sin(cos(x)+4-x)*tan(x)
x*-2
And here are some invalid expressions :-
3x+2 : should be 3*x+2
(3*x-2)(2*x+1) : should be (3*x-2)*(2*x+1)
Precedence is mainly standard but expressions like
x^x^x
are ambiguous and you should use brackets to force precedence, for example
(x^x)^x or x^(x^x)
Whenever you are not sure, use brackets.
FUNCTIONS
---------
The following functions are supported :-
exp,ln - natural logarithms.
ie exp(x) and ln(x)
sin,cos,tan,cosec,cot,sec - standard trig functions
sinh,cosh,tanh,cosech,coth,sech - standard hyperbolic trig functions
arcsin,arccos,arctan - inverse trig functions
arcsinh,arccosh,arctanh - inverse hyperbolic trig functions
CONSTANTS
---------
All letters of the alphabet (except x) can be used as constants.
Floating point entries are allowed for constants eg 0.5, 3.1415, etc
EVALUATION
----------
If there is enough demand for the addition of a routine to evaluate
expressions for a given value of x then I'll add it. Nuff said.
Write to P Young 101716.3323@compuserve.com